package com.bwie.user.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bwie.user.entity.SouEntity;
import com.bwie.user.service.SouService;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.R;



/**
 * 
 *
 * @author ShuangzhiZhao
 * @email 466505908@qq.com
 * @date 2022-02-17 14:15:27
 */
@RestController
@RequestMapping("user/sou")
public class SouController {
    @Autowired
    private SouService souService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = souService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{sid}")
    public R info(@PathVariable("sid") Integer sid){
		SouEntity sou = souService.getById(sid);

        return R.ok().put("sou", sou);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody SouEntity sou){
		souService.save(sou);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody SouEntity sou){
		souService.updateById(sou);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] sids){
		souService.removeByIds(Arrays.asList(sids));

        return R.ok();
    }

}
